import request from '@/router/axios';

export const getAllQuestion = params => {
  return request({
    url: '/quiz/web/getQuestion',
    method: 'get',
    params: params
  }).catch(error=>{
    console.log(error)
  })
}

export const getQuestionType = (params) => {
  return request({
    url: '/quiz/type',
    method: 'get',
    params
  }).catch(error=>{
    console.log(error)
  })
}

export const updateType = (data) => {
  return request({
    url: '/quiz/web/updateType',
    method: 'post',
    data
  }).catch(error=>{
    console.log(error)
  })
}
export const addType = (type) => {
  return request({
    url: '/quiz/web/addType',
    method: 'post',
    data:{type}
  }).catch(error=>{
    console.log(error)
  })
}

export const addQuestion = (data) => {
  return request({
    url: '/quiz/web/addQuestion',
    method: 'post',
    data
  }).catch(error=>{
    console.log(error)
  })
}

export const deleteQuestion = (id) => {
  return request({
    url: `/quiz/web/deleteQuestion/${id}`,
    method: 'delete'
  }).catch(error=>{
    console.log(error)
  })
}
